FUNCTIONAL PEARL A type-correct, stack-safe, provably correct expression compiler in Epigram

نویسندگان

  • JAMES MCKINNA
  • JOEL WRIGHT
  • James McKinna
  • Joel Wright
چکیده

Conventional approaches to compiler correctness, type safety and type preservation have focused on off-line proofs, either on paper or formalised with a machine, of existing compilation schemes with respect to a reference operational semantics. This pearl shows how the use of dependent types in programming, illustrated here in Epigram, allows us not only to build-in these properties, but to write programs which guarantee them by design and subsequent construction. We focus here on a very simple expression language, compiled into tree-structured code for a simple stack machine. Our purpose is not to claim any sophistication in the source language being modelled, but to show off the metalanguage as a tool for writing programs for which the type preservation and progress theorems are self-evident by construction, and finally, whose correctness can be proved directly in the system. In this simple setting we achieve the following; • a type-preserving evaluation semantics, which takes typed expressions to typed values. • a compiler, which takes typed expressions to stack-safe intermediate code. • an interpreter for compiled code, which takes stack-safe intermediate code to a big-step stack transition. • a compiler correctness proof, described via a function whose type expresses the equational correctness property.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Data representation synthesis Citation

We consider the problem of specifying combinations of data structures with complex sharing in a manner that is both declarative and results in provably correct code. In our approach, abstract data types are specified using relational algebra and functional dependencies. We describe a language of decompositions that permit the user to specify different concrete representations for relations, and...

متن کامل

Provably Correct Code Generation: A Case Study

Provably correct compilation is an important aspect in development of high assurance software systems. In this paper we present an approach to provably correct compilation based on Horn logical semantics of programming languages and partial evaluation. We also show that continuation semantics can be expressed in the Horn logical framework, and introduce Definite Clause Semantics. We illustrate ...

متن کامل

The Quest for Correct Systems: Model Checking of Diagrams and Datatypes

For the practical development of provably correct software for embedded systems the close integration of CASE tools and verification tools is required. This paper describes the combination of the CASE tool AutoFocus with the model checker SMV. AutoFocus provides graphical description techniques for system structure and behavior. In AutoFocus, data types are specified in a functional style, whil...

متن کامل

Epigram reloaded: a standalone typechecker for ETT

Epigram 1 [18, 3] is at the same time a functional programming language with dependent types and a type-driven, interactive program development system. Epigram’s type system is strong enough to express a wide range of program properties, from basic structural invariants to full specifications. The system supports the interactive development of programs exploiting types to direct the design proc...

متن کامل

A Mechanically Verified Compiling Specification for a Realistic Compiler∗

We report on a large formal verification effort in mechanically proving correct a compiling specification for a realistic bootstrap compiler from ComLisp (a subset of ANSI Common Lisp sufficiently expressive to serve as a compiler implementation language) to binary Transputer code using the PVS system. The compilation is carried out in five steps through a series of intermediate languages. In t...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2006